<template>
  <div class="details-container app-container" v-loading="listLoading">
    <div class="detail-title">
      <div>帖子详情</div>
    </div>
    <div class="detail-content">
      <el-row :gutter="80">
        <el-col :span="12">
          <div class="left-text">话题标题:</div>
          <div><el-input readonly v-model="postDetail.mid_table_remark_001" /></div>
        </el-col>
        <el-col :span="12">
          <div class="left-text">话题描述:</div>
          <div>{{ postDetail.mid_table_remark_002 }}</div>
        </el-col>
      </el-row>
      <el-row :gutter="80">
        <el-col :span="12">
          <div class="mr-2 flex-row">
            <div class="left-text">用户昵称:</div>
            <div>{{ postDetail.mid_table_remark_007 }}</div>
          </div>
          <div class="mr-2 flex-row">
            <div class="left-text">用户头像:</div>
            <el-avatar :size="50" :src="postDetail.mid_table_remark_009"></el-avatar>
          </div>
          <div class="mr-2 flex-row">
            <div class="left-text">用户电话:</div>
            <div>{{ postDetail.mid_table_remark_008 }}</div>
          </div>
        </el-col>
      </el-row>
      <el-row :gutter="80">
        <el-col :span="12">
          <div class="left-text">帖子标题:</div>
          <div><el-input readonly v-model="postDetail.mid_table_remark_003" /></div>
        </el-col>
        <el-col :span="12">
          <div class="left-text">发布年月日:</div>
          <div><el-input readonly v-model="postDetail.mid_table_remark_040" /></div>
        </el-col>
      </el-row>
      <el-row :gutter="80">
        <el-col :span="24">
          <div class="left-text">帖子图片:</div>
          <div class="demo-image__lazy">
            <el-image style="width: 120px;height: 120px;margin-right: 10px" v-for="url in postDetail.imgList" :key="url" :src="url" lazy></el-image>
          </div>
        </el-col>
      </el-row>
      <el-row :gutter="80">
        <el-col :span="24">
          <div class="left-text">帖子正文:</div>
          <el-input
            type="textarea"
            :autosize="{ minRows: 2 }"
            readonly
            style="flex: 1"
            v-model="postDetail.mid_table_remark_003" />
        </el-col>
      </el-row>
    </div>
  </div>
</template>
<script>
import waves from "@/directive/waves"; // waves directive
import { middleList } from "@/api/middle";

export default {
  name: "postDetails",
  directives: { waves },
  data() {
    return {
      id_public_middle_table:"",
      listLoading: true,
      postDetail: {},
      password: "",
      detailQuery: {
        invoke_method: "public_load_middle_table_list",
        pre_db_para_middle_table_name: 'public_middle_table_lite_mod_forum_bbs',
        type_middle_app: 62001,
        type_inner_app: 1001,
        is_online: 0,
        pre_db_para_begin_idx: 0,
        pre_db_para_length_4_list: 10,
        id_public_middle_table: null,
      },
    };
  },
  mounted() {
    let id = this.$route.query.id;
    this.id_public_middle_table = id;
    this.detailQuery.id_public_middle_table = id;

    this.getList();
  },
  methods: {
    /*
     * 获取页面数据
     * */
    getList() {
      this.listLoading = true;
      middleList(this.Qs.stringify(this.detailQuery)).then((response) => {
        let tmpUserDetail = response.page_content||[];
        this.postDetail = tmpUserDetail[0] || {};
        this.postDetail.imgList = this.postDetail.mid_table_remark_005.split('-_-')
        this.listLoading = false;
        console.log(this.postDetail);
      });

    },
  },

};
</script>

<style lang="scss" scoped>
@import "../../styles/variables";

.detail-title {
  border-bottom: 1px solid #e3e3e3;
  padding: 16px 0;
  font-size: 16px;
  font-weight: bold;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.detail-content {
  padding: 24px 24px 0;
  .el-row {
    margin-bottom: 36px;
    font-size: 14px;
    display: flex;

    .el-col {
      display: flex;
      justify-content: flex-start;
      align-items: flex-end;
      .left-text {
        color: #2d2f33;
        margin-right: 15px
      }
      .el-input {
        ::v-deep {
          .el-input__inner {
            border-radius: 0;
            border: none;
            border-bottom: 1px solid $tiffany;
            padding-left: 0;
            text-align: right;
          }
        }
      }
    }
  }
}

.other-content {
  .item-content {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 16px 24px;
    border: 1px solid #e3e3e3;
    border-bottom: none;
    &:last-child {
      border-bottom: 1px solid #e3e3e3;
    }

    .number-text {
      color: #29AE6D;
      font-weight: bold;
      margin-top: 12px;
    }

    .el-button {
      background-color: transparent;
      border: none;
      color: #29AE6D;
    }
  }
}

.flex-row {
  display: flex;
  align-items: flex-end;
}

.mr-2 {
  margin-right: 60px;
}
</style>
